#include<stdio.h>
#include<string.h>
int main()
{
	int i=0,j=0,cout=0,m,s,a[100],b[100];
	while(1){
		scanf("%d",&a[i++]);
		scanf("%d",&b[j++]);
		if(getchar()=='\n')
		break;
	}
	for(m=0;m<i;m++){
		if(b[m]==0){
		a[m]=a[m+1]*b[m+1];
		b[m]=b[m+1]-1;
		cout++;
		}
		else{
		a[m]=a[m]*b[m];
		b[m]=b[m]-1;}
	}
	if(m-cout==0)
	printf("0 0");
	for(s=0;s<m-cout;s++){
		if(s==m-cout-1)
		printf("%d %d",a[s],b[s]);
		else{
		printf("%d %d ",a[s],b[s]);
	}}
	return 0;
}
